<template>
	<view class="position-container">

		<!-- <uni-section title="职位搜索" type="line"></uni-section> -->

		<!-- <uni-search-bar placeholder="请输入职位关键词、医院名称..." @confirm="search" :focus="true" v-model="searchValue"
			@blur="blur" @input="input" @cancel="cancel" @clear="clear" clearButton="none" cancelButton="none">
		</uni-search-bar> -->

		<view class="position-list">

			<uni-list v-for="(item, index) of responseInfo.list" :key="index">
				<uni-list-item>
					<template v-slot:body>
						<view class="position" @click="toPositionInfo(item.id)">
							<view class="position-title">
								<view class="position-left">
									<view class="position-name">{{item.positionName}}</view>
									<view class="hospital-name">{{item.hospitalName?item.hospitalName:''}}</view>
									<view class="hospital-name">面试开始时间</view>
									<view class="hospital-name">面试结束时间</view>

								</view>
								<view class="position-right">
									<view class="position-salary">
										<uni-tag v-if="item.status==0" :inverted="true" text="已查看" type="primary" />
										<uni-tag v-if="item.status==1" :inverted="true" text="邀面试" type="primary" />
									</view>
									<view class="hospital-name">{{item.address}}</view>
									<view class="hospital-name">{{ parseTime(item.startTime)}}</view>
									<view class="hospital-name">{{ parseTime(item.endTime)}}</view>

								</view>
							</view>

							<!-- <view class="position-benefit">
								<view class="benefit-item">
									<uni-tag :inverted="true" text="五险一金" />
								</view>
								<view class="benefit-item">
									<uni-tag :inverted="true" text="8小时工作制" />
								</view>
								<view class="benefit-item">
									<uni-tag :inverted="true" text="节日福利" />
								</view>
								<view class="benefit-item">
									<uni-tag :inverted="true" text="提供培训" />
								</view>
							</view> -->

							<!-- <progress percent="60" stroke-width="2" activeColor="#4CD964" backgroundColor="#EBEBEB" /> -->

							<!-- <view style="margin-top: 20rpx;">
								<button class="mini-btn" type="default" size="mini" @click="toPositionInfo(item.id)">查看详情</button>
								<text style="margin-left: 20rpx;"></text>
								<button class="mini-btn" type="primary" size="mini">立即申请</button>
							</view> -->
						</view>
					</template>
				</uni-list-item>
			</uni-list>
		</view>

	</view>
</template>

<script>
	import {
		getRecruitmentInterviewPage
	} from "@/api/hospital/star.js"

	import {
		parseTime
	} from "@/utils/ruoyi"

	export default {
		data() {
			return {
				searchValue: '',
				responseInfo: {
					list: [],
					total: 0
				}
			}
		},
		mounted() {
			this.init()
		},
		onTabItemTap() {
			this.init()
		},
		activated() {
			this.queryParams.page = 1;
			this.init()
		},
		onLoad() {
			this.init()
		},
		methods: {
			init() {
				getRecruitmentInterviewPage().then(response => {
					console.log(response)
					this.responseInfo = response.data;
				})
			},
			search(res) {
				// uni.showToast({
				// 	title: '搜索：' + res.value,
				// 	icon: 'none'
				// })
			},
			input(res) {
				// console.log('----input:', res)
				this.init()
			},
			clear(res) {
				// uni.showToast({
				// 	title: 'clear事件，清除值为：' + res.value,
				// 	icon: 'none'
				// })
			},
			blur(res) {
				// uni.showToast({
				// 	title: 'blur事件，输入值为：' + res.value,
				// 	icon: 'none'
				// })
			},
			focus(e) {
				// uni.showToast({
				// 	title: 'focus事件，输出值为：' + e.value,
				// 	icon: 'none'
				// })
			},
			cancel(res) {
				// uni.showToast({
				// 	title: '点击取消，输入值为：' + res.value,
				// 	icon: 'none'
				// })
			},
			toPositionInfo(id) {
				// console.log(id)
				// this.$tab.navigateTo('/pages/positionInfo/positionInfo?id='+id)
			},
			parseTime(time) {
				return parseTime(time)
			}
		}
	}
</script>

<style lang="scss">
	.position-container {

		::v-deep .uni-list {
			background-color: initial;
		}

		::v-deep .uni-list-item {
			background: #f6ffff;
			box-shadow: 0px 3px 10px 0 rgba(0, 0, 0, 0.2);
			margin: 10rpx 0;
			border-radius: 5px;
		}

		.position-list {
			margin: 0 12px;
		}

		.position {
			width: 100%;

			.position-title {
				display: flex;
				justify-content: space-between;
			}

			.position-name {
				font-size: 36rpx;
				// color: #888888;
				font-weight: 600;
			}

			.position-salary {
				font-size: 36rpx;
				color: #ff5500;
				font-weight: 600;
			}

			.hospital-name {
				margin: 20rpx 0;
				font-size: 26rpx;
				color: #888888;
			}

			.position-right {
				text-align: right;
			}


			.position-benefit {

				display: flex;
				margin-bottom: 30rpx;

				.benefit-item {
					margin-right: 10rpx;
				}
			}
		}
	}
</style>